package com.taijihuabao.modules.controller;

import com.taijihuabao.common.jsonresult.JsonResult;
import com.taijihuabao.modules.model.checkin.dto.CheckInRuleUpDTO;
import com.taijihuabao.modules.service.CheckInRuleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 考勤规则
 *
 * @author changhui.tu
 */
@Api(tags = "考勤规则")
@RestController
@RequestMapping("/api/v1/checkRule")
public class CheckInRuleController {

    @Autowired
    private CheckInRuleService checkInRuleService;

    /**
     * 获取考勤规则
     *
     * @return
     */
    @ApiOperation("获取考勤规则")
    @GetMapping
    public JsonResult selCheckInRule() {
        return JsonResult.success(checkInRuleService.selCheckInRule());
    }

    /**
     * 修改考勤规则
     *
     * @param ruleUpDTO
     */
    @ApiOperation("修改考勤规则")
    @PutMapping
    public JsonResult updCheckInRule(@RequestBody CheckInRuleUpDTO ruleUpDTO) {
        checkInRuleService.updCheckInRule(ruleUpDTO);
        return JsonResult.success();
    }

}
